package com.hezhiqin.lock;

import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;

/**
 * @program: homeWork
 * @description:达到同步点后执行
 * @author: hezhiqin
 * @create: 2019-12-29 15:32
 */
public class CycliBarrierDemo extends Thread {

    @Override
    public void run() {
        System.out.println("开始进行数据分析");
    }

    public static void main(String[] args) {
        CyclicBarrier cyclicBarrier=new CyclicBarrier (3,new CycliBarrierDemo());
        new Thread(new DataImportThread(cyclicBarrier,"file1")).start();
        new Thread(new DataImportThread(cyclicBarrier,"file2")).start();
        new Thread(new DataImportThread(cyclicBarrier,"file3")).start();
        new Thread(new DataImportThread(cyclicBarrier,"file4")).start();
        new Thread(new DataImportThread(cyclicBarrier,"file5")).start();
        new Thread(new DataImportThread(cyclicBarrier,"file6")).start();
    }
}
